package com.yupi.project.config;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 消费者,用于处理和消费队列信息
 */
@Component
public class RabbitMQConsumer {

    @RabbitListener(queues = "${rabbitmq.queue}")//监听的队列名称 CodeDirectQueue
    @RabbitHandler
    public void process(String code) {
        System.out.println("收到的验证码为  : " + code);
    }

    @RabbitListener(queues = "${rabbitmq.deadQueue}")
    @RabbitHandler
    public void doDeadMessage(String message) {
        // todo 可以在此进行对应逻辑的编写
        System.out.println("收到的过期消息为 ===> " + message);
    }
 
}